{% extends 'templates/main.volt' %}

{% block content %}

    <form class="layui-form kg-form" method="POST" action="{{ url({'for':'admin.agency.update','id':agency.id})}}">
        <fieldset class="layui-elem-field layui-field-title">
            <legend>修改机构</legend>
        </fieldset>
        <div class="layui-form-item">
            <label class="layui-form-label">标题 <span style="color:red">*</span></label>
            <div class="layui-input-block">
                <input class="layui-input" type="text" name="title" value="{{agency.title}}" lay-verify="required">
            </div>
        </div>
        <div class="layui-form-item">
                <label class="layui-form-label">封面 <span style="color:red">*</span></label>
                <div class="layui-input-inline">
                    <img id="img-cover" class="kg-cover" src="{{agency.cover}}">
                    <input type="hidden" name="cover" value="{{agency.cover}}"  lay-verify="required">
                </div>
                <div class="layui-input-inline" style="padding-top:35px;">
                    <button id="change-cover" class="layui-btn layui-btn-sm" type="button">更换</button>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">推荐到首页 <span style="color:red">*</span></label>
                <div class="layui-input-block">
                 {% set checked0 = agency.to_index==0?"checked":"" %}
                  {% set checked1 = agency.to_index==0?"":"checked" %}
                      <input type="radio" name="to_index" value="1" title="是" {{checked1}}>
                      <input type="radio" name="to_index" value="0" title="否" {{checked0}}>
                </div>
            </div>

            <div class="layui-form-item">
                    <label class="layui-form-label">详情 <span style="color:red">*</span></label>
                    <div class="layui-input-block">
                        <textarea name="content"   lay-verify="required" class="layui-hide" id="editor-textarea">
                        {{agency.content}}</textarea>
                    </div>
                </div>

        <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <div class="layui-input-block">
                <button id="kg-submit" class="layui-btn kg-submit" lay-submit="true" lay-filter="go">提交</button>
                <button type="button" class="kg-back layui-btn layui-btn-primary">返回</button>
            </div>
        </div>
    </form>

{% endblock %}


{% block include_js %}
    {{ js_include('lib/kindeditor/kindeditor.min.js') }}
    {{ js_include('lib/kindeditor/lang/zh-CN.js') }}
    {{ js_include('admin/js/content.editor.js') }}
    {{ js_include('admin/js/cover.upload.js') }}
{% endblock %}